/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedbean;

import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import session.stateless.EmployeeBeanLocal;

/**
 *
 * @author Vincent
 */
@ManagedBean(name="setup") 
@ViewScoped
public class SetupManagedBean {

    @EJB
    EmployeeBeanLocal employeeBeanLocal;
    
    private String statusMessage;
    
    /** Creates a new instance of SetupManagedBean */
    public SetupManagedBean() {
    }

    public String getStatusMessage() {
        return statusMessage;
    }

    public void setStatusMessage(String statusMessage) {
        this.statusMessage = statusMessage;
    }
    
    public void setup(ActionEvent event){
        employeeBeanLocal.createNewEmployee("admin", "admin", "admin", "G0000000X", "admin@merlion.com", "99999999", "1 Merlion Road", (long)0, true, 7, false);
        statusMessage = "Setup is successful."; 
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, this.statusMessage, ""));  
    }
}
